package com.some;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Boss01_2 {
    public static void printChangeNum(int num) {
        int count = 0;
        while (num / 10 != 0) {
            List<Integer> list = new ArrayList<>();
            while (num != 0) {
                list.add(num % 10);
                num /= 10;
            }
            int tmp = 1;
            for (Integer i : list) {
                tmp *= i;
            }
            num = tmp;
            count++;
        }
        System.out.println(count);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        printChangeNum(num);
    }
}


